package com.chanzany.iterator.case1;

import java.util.LinkedList;
import java.util.List;

public class ComputerCollege extends College {
    private final List<Department> departments = new LinkedList<>();

    @Override
    public String getName() {
        return "计算机系";
    }

    @Override
    public void addDepartment(Department d) {
        departments.add(d);
    }

    @Override
    public Iterator<Department> iterator() {
        return new ComputerCollegeIterator(departments.toArray(new Department[0]));
    }
}
